package com.grass.p019lv.activity;

import android.content.res.Configuration;
import android.view.View;
import android.view.ViewGroup;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.base.utils.LogUtils;
import com.google.android.exoplayer2.SeekParameters;
import com.grass.p019lv.databinding.ActivityVideoPlayFullLayoutBinding;
import com.gyf.immersionbar.ImmersionBar;
import com.luck.picture.lib.config.PictureConfig;
import p000a.shuyu.p005a.GSYVideoManager;
import p000a.shuyu.p005a.builder.GSYVideoOptionBuilder;
import p000a.shuyu.p005a.listener.GSYSampleCallBack;
import p000a.shuyu.p005a.listener.GSYVideoProgressListener;
import p000a.shuyu.p005a.listener.LockClickListener;
import p000a.shuyu.p005a.utils.OrientationUtils;
import p000a.shuyu.p005a.video.StandardGSYVideoPlayer;
import p031tv.danmaku.ijk.media.exo2.Exo2PlayerManager;

/* renamed from: com.grass.lv.activity.VideoPlayFullActivity */
public class VideoPlayFullActivity extends BaseActivity<ActivityVideoPlayFullLayoutBinding> implements GSYVideoProgressListener {
    private OrientationUtils orientationUtils;
    private int status;
    public String videoPath;

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initData() {
    }

    @Override // p000a.shuyu.p005a.listener.GSYVideoProgressListener
    public void onProgress(int i, int i2, int i3, int i4) {
    }

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return R.layout.activity_video_play_full_layout;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivityVideoPlayFullLayoutBinding) this.binding).toolbar).init();
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        this.videoPath = getIntent().getStringExtra(PictureConfig.EXTRA_VIDEO_PATH);
        getWindow().addFlags(1024);
        initPlayer();
        ((ActivityVideoPlayFullLayoutBinding) this.binding).player.setUp(this.videoPath, false, "");
        ((ActivityVideoPlayFullLayoutBinding) this.binding).player.startPlayLogic();
    }

    private void initPlayer() {
        OrientationUtils orientationUtils2 = new OrientationUtils(this, ((ActivityVideoPlayFullLayoutBinding) this.binding).player);
        this.orientationUtils = orientationUtils2;
        orientationUtils2.setEnable(false);
        new GSYVideoOptionBuilder().setRotateViewAuto(false).setLockLand(false).setAutoFullWithSize(false).setShowFullAnimation(false).setNeedLockFull(true).setVideoAllCallBack(new GSYSampleCallBack() {
            /* class com.grass.p019lv.activity.VideoPlayFullActivity.C29522 */

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onPrepared(String str, Object... objArr) {
                super.onPrepared(str, objArr);
                VideoPlayFullActivity.this.orientationUtils.setEnable(true);
                try {
                    if (((ActivityVideoPlayFullLayoutBinding) VideoPlayFullActivity.this.binding).player.getGSYVideoManager().getPlayer() instanceof Exo2PlayerManager) {
                        ((Exo2PlayerManager) ((ActivityVideoPlayFullLayoutBinding) VideoPlayFullActivity.this.binding).player.getGSYVideoManager().getPlayer()).setSeekParameter(SeekParameters.NEXT_SYNC);
                    }
                } catch (Exception unused) {
                    LogUtils.m63e("---->", "设置 seek 的临近帧");
                }
            }

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onEnterFullscreen(String str, Object... objArr) {
                super.onEnterFullscreen(str, objArr);
            }

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onAutoComplete(String str, Object... objArr) {
                super.onAutoComplete(str, objArr);
            }

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onClickStartError(String str, Object... objArr) {
                super.onClickStartError(str, objArr);
            }

            @Override // p000a.shuyu.p005a.listener.VideoAllCallBack, p000a.shuyu.p005a.listener.GSYSampleCallBack
            public void onQuitFullscreen(String str, Object... objArr) {
                super.onQuitFullscreen(str, objArr);
                if (VideoPlayFullActivity.this.orientationUtils != null) {
                    VideoPlayFullActivity.this.orientationUtils.backToProtVideo();
                }
            }
        }).setLockClickListener(new LockClickListener() {
            /* class com.grass.p019lv.activity.VideoPlayFullActivity.C29511 */

            @Override // p000a.shuyu.p005a.listener.LockClickListener
            public void onClick(View view, boolean z) {
                if (VideoPlayFullActivity.this.orientationUtils != null) {
                    VideoPlayFullActivity.this.orientationUtils.setEnable(!z);
                }
            }
        }).setGSYVideoProgressListener(this).build((StandardGSYVideoPlayer) ((ActivityVideoPlayFullLayoutBinding) this.binding).player);
        ((ActivityVideoPlayFullLayoutBinding) this.binding).player.getBackButton().setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.activity.VideoPlayFullActivity.View$OnClickListenerC29533 */

            public void onClick(View view) {
                VideoPlayFullActivity.this.onBackPressed();
            }
        });
        ((ActivityVideoPlayFullLayoutBinding) this.binding).player.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.activity.VideoPlayFullActivity.View$OnClickListenerC29544 */

            public void onClick(View view) {
                VideoPlayFullActivity.this.orientationUtils.resolveByClick();
                ((ActivityVideoPlayFullLayoutBinding) VideoPlayFullActivity.this.binding).player.startWindowFullscreen(VideoPlayFullActivity.this, true, true);
            }
        });
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        ((ActivityVideoPlayFullLayoutBinding) this.binding).player.onConfigurationChanged(this, configuration, this.orientationUtils, true, true);
    }

    @Override // androidx.activity.ComponentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onBackPressed() {
        OrientationUtils orientationUtils2 = this.orientationUtils;
        if (orientationUtils2 != null) {
            orientationUtils2.backToProtVideo();
        }
        if (!GSYVideoManager.backFromWindowFull(this)) {
            super.onBackPressed();
        }
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity
    public void onPause() {
        ((ActivityVideoPlayFullLayoutBinding) this.binding).player.onVideoPause();
        super.onPause();
    }

    public static void setViewHeight(View view, int i) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        layoutParams.height = i;
        view.setLayoutParams(layoutParams);
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onDestroy() {
        if (!(this.binding == null || ((ActivityVideoPlayFullLayoutBinding) this.binding).player == null)) {
            ((ActivityVideoPlayFullLayoutBinding) this.binding).player.release();
        }
        OrientationUtils orientationUtils2 = this.orientationUtils;
        if (orientationUtils2 != null) {
            orientationUtils2.releaseListener();
        }
        super.onDestroy();
    }

    /* renamed from: com.grass.lv.activity.VideoPlayFullActivity$OnClick */
    public class OnClick {
        public OnClick() {
        }

        public void btnBack() {
            VideoPlayFullActivity.this.finish();
        }
    }
}
